function xsamp = SampleNDimGaussian(mu,Sigma)

% sample an N-dimensional gaussian
% input: mu = mean, Sigma = NxN covariance matrix

A = chol(Sigma);

z = randn( size(mu,1), size(mu,2) );
xsamp = 0*mu;
z = randn( size(mu,1), size(mu,2) );
xsamp = mu + A*z;
